|
|
 |
|
|
|
|
A = Nx
B = Ny
C = Nz
D = -(Nx * Point1.Trans(1) + _
Ny * Point1.Trans(2) + _
Nz * Point1.Trans(3))
' If the denominator = 0, the ray is parallel
' to the plane so there's no intersection. denom = A * Vx + B * Vy + C * Vz
If denom = 0 Then
RayTraceable_FindT = -1
Exit Function
End If
' Solve for t. t = -(A * px + B * py + C * pz + D) / denom
' If there is no positive t value, there's no
' intersection in this direction. If t < 0.01 Then
RayTraceable_FindT = -1
Exit Function
End If
' Get the coordinates of the disk's center. Cx = Point1.Trans(1)
Cy = Point1.Trans(2)
Cz = Point1.Trans(3)
' Get the point of intersection with the plane. X = px + t * Vx
Y = py + t * Vy
Z = pz + t * Vz
' See if the point is within distance
' Radius of the center. dx = Cx - X
dy = Cy - Y
dz = Cz - Z
If dx * dx + dy * dy + dz * dz > Radius * Radius Then ' We are not within distance Radius. RayTraceable_FindT = -1
Exit Function
End If
' We had a hit. If direct_calculation Then HadHit = True
RayTraceable_FindT = t
End Function |
|
|
|
|
|